package com.bwie.system.api.factory;

import com.bwie.common.core.domain.R;
import com.bwie.common.core.domain.Result;
import com.bwie.system.api.RemoteFileService;
import com.bwie.system.api.RemoteSearchService;
import com.bwie.system.api.domain.SysFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteSearchFallbackFactory implements FallbackFactory<RemoteSearchService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSearchFallbackFactory.class);

    @Override
    public RemoteSearchService create(Throwable cause) {
        return new RemoteSearchService() {
            @Override
            public Result esSaveProduct(String skuEsModelList) {
                return Result.error("批量将选中的spu下的sku信息添加到es中失败，错误信息是："+cause.getMessage());
            }

            @Override
            public Result esDelProduct(Long spuId) {
                return Result.error("根据spuId删除es中的sku信息失败，错误信息是："+cause.getMessage());
            }
        };
    }
}
